﻿using MyCanFD;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace CarPCBATest.Procedure
{
    public class S12L_LedA : S12L_Led
    {
        protected override void SendControlLedCommand()
        {
            if (counter % 2 == 0)
            {
                canFd.SendMessage(0x276, "00 00 00 00 00 00 00 00", 0);
            }

            if (counter % 2 == 1)
            {
                byte stopLedLightness = Convert.ToByte(StopLedLightness);
                byte turnLeftLedLightness = Convert.ToByte(TurnLeftLedLightness);
                byte turnRightLedLightness = Convert.ToByte(TurnRightLedLightness);

                byte[] cmd0x277 = { stopLedLightness };
                cmd0x277 = cmd0x277.Concat(Enumerable.Repeat(turnLeftLedLightness, 15)).Concat(Enumerable.Repeat((byte)0, 48)).ToArray();

                byte[] cmd0x279 = { stopLedLightness };
                cmd0x279 = cmd0x279.Concat(Enumerable.Repeat(turnRightLedLightness, 15)).Concat(Enumerable.Repeat((byte)0, 48)).ToArray();

                canFd.SendMessage(0x277, cmd0x277, 0);
                canFd.SendMessage(0x279, cmd0x279, 0);                                                                                                                                                                                                    //canFd.SendMessage(0x277, "20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ", 0);
            }
            counter++;
        }
    }
}